<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="__ROOT__/Public/admin/css/style.css" rel="stylesheet">
<link href="__ROOT__/Public/admin/css/font-awesome.min.css" rel="stylesheet">
<link href="__ROOT__/Public/plugin/select2/select2.css" rel="stylesheet">
<script src="__ROOT__/Public/admin/laydate/laydate.js"></script>
<title>商品数据</title>
</head>

<style>
.page {
    margin: 10px 0;
    *zoom: 1;
}
.page:before,
.page:after {
    display: table;
    content: "";
}
.page:after {
    clear:both;
}
.page a,
.page span {
    float: left;
    margin-left: -1px;
    padding: 0 14px;
    height: 30px;
    line-height: 30px;
    color: #000;
    border-top: 1px solid #CCCCCC;
    border-bottom: 1px solid #CCCCCC;
    /*background-color: #4bbd00;*/
}
.page a:hover
 {
    text-decoration: none;
    background-color: #387C0B;
}
.page .current {
	border-top: 1px solid #387C0B;
}
.page .next,
.page .prev {
    font-family: "宋体";
    font-weight: bold;
}
.page .rows {
	border-right: 1px solid #CCCCCC;
}
.page .rows {
	border-right: 1px solid #CCCCCC;
}

</style>


<body>
	<div id="show">
		<div class="breadNav">
			<ul class="breadNavBar">
				<li><i class="icon-home"></i></li>
				<li><a href="#">首页</a></li>
				<li>&gt;</li>
				<li><a href="#">订单管理</a></li>
				<li>&gt;</li>
				<li><a href="#" class="active">{$title}</a></li>
			</ul>
		</div>
		<div style="clear:both;"></div>
		<div class="filter">
			<div class="filter" style="float:left; margin-top:0px;">
              <a href="__ROOT__/Admin/BookOrderManage/OutputOrder" class="btn btn-primary btn-lg" id="backBtn"><i class="icon-add"></i>&nbsp;导出已支付订单</a>
            </div>
			<div class="form-group" style="float:right">
				<form action="__ROOT__/Admin/BookOrderManage/query_order" method="get">
					<label class="control-label">订单号:</label>
                    <input type="text" class="form-control" name="order_id" placeholder="请输入订单号"/>
                    <label class="control-label">昵称:</label>
                    <input type="text" class="form-control" name="nick_name" placeholder="请输入昵称"/>
                    <label class="control-label">订单状态:</label>
                    <select class="form-control" name="status">
                    <option value='1'>已支付</option>
                    <option value='2'>已发货</option>
                    <option value='3'>已收货</option>
                     <option value='4'>未支付</option>
                    </select>
					<label class="control-label">订单时间:</label>
					<input type="text" class="form-control laydate-icon" name="starttime" value="{$searchinfo.starttime}"  placeholder="请输入日期" onclick="laydate()">
					-
					<input type="text" class="form-control laydate-icon" name="endtime" value="{$searchinfo.endtime}"  placeholder="请输入日期" onclick="laydate()">
					 <input type="hidden" name="order_type" value="{$order_type}">
					<button class="btn btn-primary add" type="submit"><i class="icon-search"></i>&nbsp;搜索</button>
				</form>
			</div>
		</div>
        <form action="" method="post">
		<table class="table">
			<thead>
				<tr>
					<th width="3%"></th>
					<th>昵称</th>
					<th>订单号</th>
					<th>商品名字</th>
					<th>单价</th>
					<th>数量</th>
					<th>总价</th>
					<th>日期</th>
					<th>收件人姓名</th>
					<th>联系电话</th>
					<th>收货地址</th>
					<th>订单状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody id="dataInfo">
				<volist name="Order_List" id="vb">
				<tr>
				  <td ><input type="checkbox" name="id[]" value="{$vb.order_id}"></td>
				  <td align="left">{$vb.nick_name}</td>
				  <td align="left">{$vb.order_id}</td>
				  <td align="left">{$vb.goods_name}</td>
				  <td align="left">{$vb.single_price}</td>
				  <td align="left">{$vb.count}</td>
				  <td align="left">{$vb.total_price}</td>
				  <td align="left">{$vb.date|date="Y-m-d",###}</td>
				  <td align="left">{$vb.consignee}</td>
				  <td align="left">{$vb.tel}</td>
				  <td align="left">{$vb.address}</td>
				  <td align="left"><if condition="$vb.status eq 1 ">已支付<elseif condition="$vb.status eq 2"/>已发货<elseif condition="$vb.status eq 3"/>已收货<elseif condition="$vb.status eq 4"/>未支付</if></td>
				  <td name="de">
						<a class="btn btn-table" href="__ROOT__/Admin/BookOrderManage/Edit_status/order_id/{$vb.order_id}"><i class="icon-edit"></i>&nbsp;编辑订单状态</a>
						<a class="btn btn-table" name="delete_single" id="{$vb.order_id}"><i class="icon-remove"></i>&nbsp;删除</a>
				  </td>
				</tr>
				</volist>
				 <tr>
					<td align="left" colspan="12"><font>订单总金额：</font></td>
					<td align="center" colspan="1"><font id=money color='red'>{$money}</font></td>
				</tr>
				<tr>
					<td><input type="checkbox" id="areaSelAll"></td>
					<td align="left" colspan="13"><a name='delete_all' class="btn btn-table" href="javascript:;" class="allDel"><i class="icon-trash"></i>&nbsp;批量删除</a></td>
				</tr>
			</tbody>
		</table>
        </form>
	</div>
	<div class="page">
        {$page}
	</div>
	
</body>
<script src="__ROOT__/Public/js/jquery.min.js?ver=1.8.3"></script>
<script src="__ROOT__/Public/admin/js/main.js"></script>
<script src="__ROOT__/Public/js/titleMes.js"></script>
<script src="__ROOT__/Public/plugin/select2/select2.min.js"></script>
<script>
   
$('a[name=delete_single]').click(function(){
	   var self=$(this);										
	     if(confirm('确认要删除吗？')){
	    	 var type=$("input[type=hidden][name='order_type']").val();
	    	 var v_id = $(this).attr('id');
$.post("__ROOT__/Admin/BookOrderManage/Delete_order",{order_id:v_id},function(data){
	      if(data.delCount==true){
	    	  self.parent().parent().remove();
	    	  var nowMoney=$('#money').html()-data.money;
	    	  $('#money').html(nowMoney);
	      }
	  })
	    .error(function() { alert("请求出错"); })
	  ;
      
	     }
});
$('a[name=delete_all]').click(function(){
	   if(confirm('确认要删除吗？')){
    var type=$("input[type=hidden][name='order_type']").val();
	   var d=$("input[type=checkbox][name='id[]']:checked");
	   var v='';
	   for(var i = 0; d && i < d.length; i++) {  
	          v += $(d[i]).val()+'@';  
	    }
	   if(v!=''){
	   $.post("__ROOT__/Admin/BookOrderManage/Delete_all",{ids:v},function(data){
		 
	      if(data.delCount==true){
	    	 $("input[type=checkbox][name='id[]']:checked").parent().parent().remove();
	    	  var nowMoney=$('#money').html()-data.money;
	    	 $('#money').html(nowMoney);
	      }
	  });
	   }
	   }
	  
	  
});

   
</script>
</html>
